<template>
    <!-- 业务工作台 -->
    <div class="container">
        <div class="fixed">
            <el-button type="primary" icon="Edit" @click="goEdit">编辑</el-button>
        </div>
        <Preview :config="workbench.publishedConfig" />
    </div>
</template>
<script setup>
import { onMounted } from "vue";
import defConfig from "../../workbench/design/example/default";
import * as _ from "lodash";
import Preview from "../../workbench/design/preview.vue";
import { useRouter } from "vue-router";

const workbench = ref({ publishedConfig: {} });
const router = useRouter();

onMounted(() => {
    //查询租户业务工作台
    app.https.get("/sys/workbench/tenant").then((resp) => {
        if (!resp.publishedConfig) {
            resp.publishedConfig = defConfig;
        }

        workbench.value = resp;
    });
});

function goEdit() {
    router.push("/workbench/design/" + workbench.value.id);
}
</script>

<style lang="scss" scoped>
.fixed {
    position: fixed;
    top: 50px;
    left: 50%;
    z-index: 10;
}
</style>
